package day14_21.day20;

import java.util.Scanner;

public class Main02 {
    public static void main(String[] args) {
        Scanner scn = new Scanner(System.in);
        String str1 = scn.next();
        String str2 = scn.next();

        String[] str1A = str1.split("");
        String[] str2A = str2.split("");
        int max = 0;
        for (int i = 0 ; i < str1A.length ; i ++){
            for (int j = 0; j < str2A.length; j++) {
                int n = i;
                int m = j;
                while (str1A[i].equals(str2A[j]) && i < str1A.length - 1  && j < str2A.length - 1){
                    i ++;
                    j ++;
                }
                max = Math.max(max , i - n);
                i = n;
                j = m;
            }
        }
        System.out.println(max);
    }
}
